package com.wenxixuanwu.fruitstore.service.impl;

import com.wenxixuanwu.fruitstore.entity.User;
import com.wenxixuanwu.fruitstore.mapper.BackUserMapper;
import com.wenxixuanwu.fruitstore.service.BackUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author :小凡凡
 * @version :1.0
 * @Project :fruitstore
 * @Date :2022/4/20
 */
@Service
public class BackUserServiceImpl implements BackUserService {

    @Autowired
    private BackUserMapper userMapper;

    @Override
    public List<User> findUserAll() {
        List<User> users = userMapper.findUserAll();
        return users;
    }

    @Override
    public User getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    @Override
    @Transactional //开启用户数据事务
    public Integer updateUserById(User user) {
        return userMapper.updateUserById(user);
    }
}
